<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    #div1 {
      width: 200px;
      height: 200px;
      background: rgb(141, 72, 72);
    }
  </style>
</head>

<body>
  <div id="div1"></div>
  <script>
    const div1 = document.getElementById("div1")

    // 绑定事件的方法（2种）
    // 1.onclick
    // 2.addEventListener("",function(){},false) //false:冒泡
    // div1.onmousemove = function(){}
    div1.addEventListener("mouseover",function(){
      console.log('进去了');
    },false);
    div1.addEventListener("mouseout",function(){
      console.log('出去了');
    },false);
  </script>
</body>

</html>